//
//  TSFindsence.m
//  TaShuo
//
//  Created by N-X on 2018/3/5.
//  Copyright © 2018年 MRNAN. All rights reserved.
//

#import "TSFindScene.h"
#import "TSFindSceneViewModel.h"

@interface TSFindScene ()
@property (nonatomic ,strong)UITableView * tableView;
@property (nonatomic ,strong)TSFindSceneViewModel * sceneVM;
@end

@implementation TSFindScene


#pragma mark - getter
- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - self.navigationBarHeight - self.tabBarHeight) style:UITableViewStyleGrouped];
    }
    return _tableView;
}

- (TSFindSceneViewModel *)sceneVM
{
    if (!_sceneVM) {
        _sceneVM = [[TSFindSceneViewModel alloc]init];
    }
    return _sceneVM;
}

#pragma mark - life cycle

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    self.tableView.alpha = 0;
    [self.sceneVM bindView:self.tableView];
    @weakify(self)
    [[self.sceneVM.fetchFindDataCommand execute:nil] subscribeNext:^(id  _Nullable x) {
     @strongify(self)
        [UIView animateWithDuration:0.2 animations:^{
            self.tableView.alpha = 1;
        }];
        [self.tableView reloadData];
        NXLog(@"x==== %@",x);
    } error:^(NSError * _Nullable error) {
        NXLog(@"error== %@",error.description);
    }];
}



@end
